//
//  StoreSearchViewController.h
//  iFoundIt
//
//  Created by Navid Shariat on 4/05/10.
//  Copyright 2010 QUT. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SearchProps.h"
#import <CoreLocation/CoreLocation.h>
#import "StorePersistentManager.h"
#import "WishedItem.h"
#import "WishlistPersistentManager.h"

@interface StoreSearchViewController : UIViewController<UITextFieldDelegate, UIActionSheetDelegate, CLLocationManagerDelegate> {

	IBOutlet UITextField * radiusTextField;
	IBOutlet UITextField * keywordTextField;	
	CLLocationManager * locationManager;
	CLLocation *currentLocation;	
	CLLocationCoordinate2D currentLocationCoordinate;	
	
	UIViewController *nextViewController;
	
	//Segmented Control
	IBOutlet UISegmentedControl * resultTypeSegmentedC;	
	IBOutlet UIButton * pickCategoryButton;
	IBOutlet UIButton * searchButton;
	IBOutlet UIActivityIndicatorView * myActivityView;
	IBOutlet UIView *modelView;
	IBOutlet UIImageView * splashImage;

}

@property (nonatomic, retain) UITextField * radiusTextField;
@property (nonatomic, retain) UITextField * keywordTextField;	
@property (nonatomic, retain) UISegmentedControl * resultTypeSegmentedC;	
@property (nonatomic, retain) UIButton * pickCategoryButton;
@property (nonatomic, retain) UIButton * searchButton;
@property (nonatomic, retain) CLLocationManager *locationManager;
@property (nonatomic, retain) CLLocation *currentLocation;	
@property (nonatomic, retain) UIActivityIndicatorView * myActivityView;
@property (nonatomic, readwrite) CLLocationCoordinate2D currentLocationCoordinate;	
@property (nonatomic, retain) UIView *modelView;
@property (nonatomic, retain) UIImageView * splashImage;


#pragma mark Buttons
- (IBAction) searchButtonPressed:(id) sender;
- (IBAction) pickCategoryButtonPressed:(id) sender;

# pragma mark Action
- (IBAction) backgroundPressed;
- (IBAction)textFieldDoneEditing:(id)sender;

#pragma mark methods
- (void) navigateToMapView:  (NSMutableArray *)  stores;
- (void) navigateToListView: (NSMutableArray *) stores;
- (void) navigateTo: (NSMutableArray *) stores;
- (NSString*)fieldsAreValid;
- (void)initLocationManager;
- (void) findStores;
- (void) addSearchToWishlist;
- (NSMutableArray*) sortFoundStores:(NSMutableArray*)stores;
- (void)setKeywordText: (NSString *) text;


- (void)showSplash;
- (void)hideSplash;
	
@end
